package com.example.email.service.impl;

import com.example.email.config.MailComponent;
import com.example.email.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 邮件群发
 */
@Service
public class MailServiceImpl implements MailService {

    @Autowired
    private MailComponent mailComponent;

    @Async("asyncServiceExecutor")
    @Override
    public void sendSimpleMail(String[] to, String subject, String content) {
        for (String receiveStr : to) {
            mailComponent.sendMail(receiveStr, subject, content);
        }
    }


}